home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Borland / Borland C++ V5.02 / GLYPHBTN.PAK / GLYPHBTX.CPP < prev    next >
C/C++ Source or Header  |  1997-05-06  |  2KB  |  83 lines

  1. //----------------------------------------------------------------------------
  2. // ObjectWindows
  3. // Copyright (c) 1995, 1995 by Borland International, All Rights Reserved
  4. //----------------------------------------------------------------------------
  5. #include <owl/pch.h>
  6. #if !defined(OWL_GLYPHBTN_H)
  7. # include <owl/glyphbtn.h>
  8. #endif
  9. #if !defined(OWL_CHECKBOX_H)
  10. # include <owl/checkbox.h>
  11. #endif
  12. #if !defined(WINSYS_COLOR_H)
  13. # include <winsys/color.h>
  14. #endif
  15. #include "glyphbtn.h"
  16.  
  17. //
  18. // Class TSampleApp
  19. // ~~~~~ ~~~~~~~~~~
  20. class TSampleApp : public TApplication {
  21.   public:
  22.     void    InitMainWindow();
  23. };
  24.  
  25. //
  26. // Class TClientWindow
  27. // ~~~~~ ~~~~~~~~~~~~~
  28. class TClientWindow : public TDialog {
  29.   public:
  30.     TClientWindow(TWindow* parent = 0);
  31.  
  32.     void SetupWindow() {
  33.       TDialog::SetupWindow();
  34.       EnableHelp->Check();
  35.     }
  36.  
  37.     void CmEnableHelp() {
  38.       HelpButton->EnableWindow(EnableHelp->GetCheck());
  39.     }
  40.  
  41.   private:
  42.     TCheckBox* EnableHelp;
  43.     TGlyphButton* HelpButton;
  44.  
  45.   DECLARE_RESPONSE_TABLE(TClientWindow);
  46. };
  47.  
  48. DEFINE_RESPONSE_TABLE1(TClientWindow, TWindow)
  49.   EV_COMMAND(IDC_ENABLEHELP, CmEnableHelp),
  50. END_RESPONSE_TABLE;
  51.  
  52.  
  53. TClientWindow::TClientWindow(TWindow* parent)
  54. :
  55.  TDialog(parent, IDD_CLIENTDLG, 0)
  56. {
  57.   TGlyphButton* glyph1 = new TGlyphButton(this, IDC_1);
  58.   glyph1->SetGlyph(new TBtnBitmap(*GetApplication(), IDB_BORBTNII_OK));
  59.   TGlyphButton* glyph2 = new TGlyphButton(this, IDC_2);
  60.   glyph2->SetGlyph(IDB_BORBTNII_CANCEL);
  61.   HelpButton = new TGlyphButton(this, IDC_3);
  62.   HelpButton->SetGlyph(IDB_BORBTNII_HELP);
  63.   HelpButton->SetGlyph(IDB_BORBTNII_HELPG, 0, TGlyphButton::gtDisabled);
  64.  
  65.   EnableHelp = new TCheckBox(this, IDC_ENABLEHELP);
  66.  
  67.   SetBkgndColor(TColor::Sys3dFace);
  68. }
  69.  
  70. void
  71. TSampleApp::InitMainWindow()
  72. {
  73.   SetMainWindow(new TFrameWindow(0, "Bitmap Button",
  74.                                  new TClientWindow(), true));
  75.   GetMainWindow()->Attr.Style &= ~WS_THICKFRAME;
  76. }
  77.  
  78. int
  79. OwlMain(int /*argc*/, char* /*argv*/ [])
  80. {
  81.   return TSampleApp().Run();
  82. }
  83.